package cn.lzy.profile.config;

import cn.lzy.profile.DataSource;
import cn.lzy.profile.MyProfile;
import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Profile;

/**
 * @Description
 * @Author Administrator
 * @Date 2023/11/29 16:53
 * @Version
 **/
public class CustomJavaConfig {

    @Bean
    @MyProfile("test")
    DataSource testDataSource() {
        DataSource dataSource = new DataSource();
        dataSource.setUrl("jdbc:mysql://127.0.0.1/test");
        dataSource.setUsername("test");
        dataSource.setPassword("test");
        return dataSource;
    }


    @Bean
    @MyProfile("self")
    DataSource selfDataSource() {
        DataSource dataSource = new DataSource();
        dataSource.setUrl("jdbc:mysql://127.0.0.1/self");
        dataSource.setUsername("self");
        dataSource.setPassword("self");
        return dataSource;
    }
}
